﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ActiveYellow2_ActiveYellow2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            if (Request.QueryString.HasKeys())
            {
                if (Request.QueryString["listid"] != String.Empty)
                    Session["listid"] = Request.QueryString["listid"];
                else
                    Session["listid"] = 1;


                if (Request.QueryString["dnis"] != null)
                {
                    Session["dnis"] = Request.QueryString["dnis"];
                }
                else
                {
                    Session["dnis"] = "9999999999";
                }

                Session["servername"] = Request.QueryString["servername"];
                Session["projectname"] = Request.QueryString["projectname"];
                Session["campaignname"] = Request.QueryString["campaignname"];
                Session["agentid"] = Request.QueryString["agentid"];
                Session["agentfirst"] = Request.QueryString["agentfirst"];
                Session["agentlast"] = Request.QueryString["agentlast"];

                Session["App"] = new DataAccess();


                MultiView1.SetActiveView(View1);
                prevpage.Text = "View1";
            }

            lblAgentFirst.Text = Session["agentfirst"].ToString();

            //ValidateIBListID();
        }
    }
    protected void rblNav_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.rblNav.SelectedItem.Value == "FAQ")
        {
            prevpage.Text = MultiView1.ActiveViewIndex.ToString();
            MultiView1.SetActiveView(View3);
            return;
        }
        if (this.rblNav.SelectedItem.Value == "CInfo")
        {
            MultiView1.SetActiveView(View1);
            return;
        }
    }
    protected void rblOrderReq_SelectedIndexChanged(object sender, EventArgs e)
    {
        Button1.Enabled = true;
        if (rblOrderReq.SelectedItem.Value == "yes")
        {
            Button1.Visible = true;
            Button1.Text = "Next";
            Button1.CommandName = "NextView";
        }
        if (rblOrderReq.SelectedItem.Value == "no")
        {
            Button1.Visible = false;
            // Button1.Text = "Finish";
            //Button1.CommandName = "";
        }
    }
    protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
    {

        /*  View lastview = (View)sender;
          if (lastview.ID == "page1")
          {
              btnFAQ.CommandArgument = "View2";
          }
          else if (lastview.ID == "page2")
          {
              btnFAQ.CommandArgument = "View2";
          }*/

        switch (MultiView1.ActiveViewIndex)
        {
            case 0:
                rblNav.Items[0].Selected = true;
                rblNav.Items[1].Selected = false;
                btnDisposition.Visible = true;
                break;
            case 1:
                btnDisposition.Visible = true;
                break;
            case 2:
                rblNav.Items[1].Selected = true;
                rblNav.Items[0].Selected = false;
                btnDisposition.Visible = false;
                break;
            case 3:
                rblNav.Visible = false;
                btnDisposition.Visible = false;
                break;
        }

    }

    protected void btnFAQ_Click(object sender, EventArgs e)
    {
        btnFAQ.CommandArgument = prevpage.Text;

        //if (rblOrderReq.SelectedIndex > -1)
        //{
        //    if (rblOrderReq.SelectedItem.Value == "yes")
        //    {
        //        btnFAQ.CommandArgument = "View2";
        //    }
        //    else
        //    {
        //        btnFAQ.CommandArgument = "View1";
        //    }
        //}

    }
    protected void btnDisposition_Click(object sender, EventArgs e)
    {

        ((DataAccess)Session["App"]).PutCallData("FirstName", tbFName.Text);
        ((DataAccess)Session["App"]).PutCallData("LastName", tbLName.Text);
        ((DataAccess)Session["App"]).PutCallData("Zipcode", tbZip.Text);
        ((DataAccess)Session["App"]).PutCallData("PrimaryPhone", tbPhone.Text);
        ((DataAccess)Session["App"]).PutCallData("AYOrderNumber", tbOrderNum.Text);
        ((DataAccess)Session["App"]).CommitCallData();
        MultiView1.SetActiveView(View4);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //System.Web.UI.WebControls.View 
        prevpage.Text = MultiView1.ActiveViewIndex.ToString();

    }
}